home *** CD-ROM | disk | FTP | other *** search
/ Day Cry / Day Cry CD.bin / oh_towns / ugoku / src.lzh / MOVRLF / MRLFTIF.C < prev    next >
Text File  |  1994-06-01  |  28KB  |  1,134 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <winb.h>
  5. #include <te.h>
  6. #include <fntb.h>
  7. #include <gui.h>
  8. #include <file_dlg.h>
  9. #include <tifflib.h>
  10. #include <egb.h>
  11. #include <mos.h>
  12. #include <snd.h>
  13. #include "ugoku.h"
  14. #include "video.h"
  15. #include "movrlf.h"
  16.  
  17. int    tifDialogId[5] = -1 ;
  18. int    tifListMenuId0 = -1 ;
  19. int    tifScrollBarId0 = -1 ;
  20. int    tifMesId[16] = -1 ;
  21. int    tifTIconId[2] = -1 ;
  22. int    tifDButtonId[9] = -1 ;
  23. int    tifListMenuId1 = -1 ;
  24. int    tifNumBoxId = -1 ;
  25. int    tifScrollBarId1 = -1 ;
  26. int    tifWaitDialogId = -1 ;
  27.  
  28. int xtif, ytif;            /* ô╟é▌ì₧é±é╛tifâfü[â^ */
  29. int tifFirstFlg = 0 ;    /* ì┼Åëé═0,2ë±û┌ê╚ì~é═-1(tifâfâBâîâNâgâèò╧ìXé╚éτ0) */
  30.  
  31. static char name[ F_MAX+8 ][20] ;
  32. static int tifCutBuf[ F_MAX+8 ] ;
  33. static int total ;
  34. static int cutNum = 0 ;
  35. static int tifTMode = 0 ;
  36. static int tifPrt0 = 0 ;    /* ôoÿ^é│éΩé╜tifé╠ô¬ê╩Æu */
  37. static int tifPrt = 0 ;        /* ôoÿ^é│éΩé╜tifé╠î╗ì▌ê╩Æu */
  38. static char tifFilePath[100] ;    /* âpâXé≡ò█æ╢ */
  39.  
  40. tifFileEdit( char *path )
  41. {
  42.     int i, j, n, m ;
  43.     char path2[100];
  44.  
  45.     MMI_SendMessage( tifDialogId[0], MM_ATTACH, 1, baseDialogId ) ;
  46.     MTL_setFlagObj( tifTIconId[tifTMode+0], (MS_UNSELECT | MS_TOGGLE) ) ;
  47.  
  48.     if( tifFirstFlg == 0 )
  49.     {
  50.         for( i=0 ; i<80 ; i++ )
  51.         {
  52.             path2[i] = path[i] ;
  53.             tifFilePath[i] = path[i] ;
  54.             if( path[i] == '\0' )break ;
  55.         }
  56.         path2[i++] = '*';
  57.         path2[i++] = '.';
  58.         path2[i++] = 'T';
  59.         path2[i++] = 'I';
  60.         path2[i++] = 'F';
  61.         path2[i++] = '\0';
  62.  
  63.         total = look_files_all( name, path2 );
  64.         look_file_seiri( total, name );
  65.  
  66.         /*    âèâXâgâüâjâàü[é╠É▌ÆΦ */
  67.         MTL_resetAtrObj(tifListMenuId0, ((~MS_SCROLLL40) & (~MS_MSELECTL40)) );
  68.         if( tifTMode )
  69.             MTL_setAtrObj(tifListMenuId0, (MS_SCROLLL40 | MS_MSELECTL40) ) ;
  70.         else
  71.             MTL_setAtrObj(tifListMenuId0, MS_SCROLLL40 ) ;
  72.         MMI_SendMessage(tifListMenuId0, MM_SETMAXROWCOLUM, 2, 0, 0) ;
  73.         MMI_SendMessage(tifListMenuId0, MM_SETMAXROWCOLUM, 2, total+32, 1) ;
  74.         MMI_SendMessage(tifListMenuId0, MM_SETCOLUMLEN, 2, 0, 16) ;
  75.  
  76.         MTL_setAtrObj(tifListMenuId1, (MS_SCROLLL40 | MS_MSELECTL40) ) ;
  77.         MMI_SendMessage(tifListMenuId1, MM_SETMAXROWCOLUM, 2, 0, 0) ;
  78.         MMI_SendMessage(tifListMenuId1, MM_SETMAXROWCOLUM, 2, F_MAX+32, 1) ;
  79.         MMI_SendMessage(tifListMenuId1, MM_SETCOLUMLEN, 2, 0, 16) ;
  80.         tifTotal = 0 ;
  81.         tifPrt = tifTotal ;
  82.         tifPrt0 = 0 ;
  83.         tifFirstFlg = -1 ;
  84.  
  85.         for (i = 0 ; i < total ; i++)
  86.             MMI_SendMessage(tifListMenuId0, MM_SETROWCOLUM,
  87.              3, i, 0, name[i]) ;
  88.         n = 24 ; m = total + 23 ;
  89.         MMI_SendMessage( tifScrollBarId0, MM_SETSCROLL, 5,
  90.             n-1, n-1, (m < n)?(n - 1):(m - 1), n, 4 ) ;
  91.  
  92.         for (i = 0 ; i < tifTotal ; i++)
  93.             MMI_SendMessage(tifListMenuId1, MM_SETROWCOLUM,
  94.              3, i, 0, tifName[i]) ;
  95.         n = 24 ; m = tifTotal + 23 ;
  96.         MMI_SendMessage( tifScrollBarId1, MM_SETSCROLL, 5,
  97.             n-1, n-1, (m < n)?(n - 1):(m - 1), n, 4 ) ;
  98.     }
  99.  
  100.     cutNum = 0 ;
  101.  
  102.     tifFileEditButton( 0 ) ;
  103.  
  104.     MMI_SendMessage( tifDialogId[0], MM_SHOW, 0 ) ; /* î⌐é╣éΘ */
  105.  
  106.     MMI_ExecSystem() ;        /* Dialogò\Īé╓ÑÑÑâCâxâôâgâïü[âv */
  107.  
  108.     LISTITEML40 *plitem ;
  109.     int maxRow, maxColum ;
  110.  
  111.     MMI_SendMessage( tifListMenuId1, MM_GETLMENUPTR, 3,
  112.                         &plitem, &maxRow, &maxColum ) ;
  113.     for( i=0 ; i<tifTotal ; i++ )
  114.     {
  115.         for( j=0 ; j<13 ; j++ )
  116.         {
  117.             tifName[i][j] = (plitem[i].string)[j] ;
  118.             if( tifName[i][j] == '\0' )break ;
  119.         }
  120.     }
  121.  
  122.     MMI_SendMessage( tifDialogId[0], MM_ERASE, 0 ) ;
  123.     MMI_SendMessage( tifDialogId[0], MM_DETACH, 0 ) ;
  124.  
  125.     return NOERR ;
  126. }
  127.  
  128. /* â{â^âôé╠ùLî°Ñû│î°É▌ÆΦâïü[â`âô */
  129. tifFileEditButton( mode )    /* mode!=0é╚éτSHOWé╖éΘ */
  130. int mode ;
  131. {
  132.     int i, atr[6], atr2 ;
  133.  
  134.     for( i=0 ; i<6 ; i++ )
  135.     {
  136.         atr[i] = MS_DSPONLYL40 ;
  137.         atr[i] = MTL_checkAtrObj( tifDButtonId[i], atr[i] ) ;
  138.     }
  139.  
  140.     MTL_resetAtrObj( tifDButtonId[0], (~MS_DSPONLYL40) ) ;    /* 1ü`2bit clear */
  141.     MTL_resetAtrObj( tifMesId[0], (~MS_DSPONLYL40) ) ;
  142.     MTL_resetAtrObj( tifDButtonId[2], (~MS_DSPONLYL40) ) ;
  143.     MTL_resetAtrObj( tifMesId[2], (~MS_DSPONLYL40) ) ;
  144.     MTL_resetAtrObj( tifDButtonId[3], (~MS_DSPONLYL40) ) ;
  145.     MTL_resetAtrObj( tifMesId[3], (~MS_DSPONLYL40) ) ;
  146.     MTL_resetAtrObj( tifDButtonId[4], (~MS_DSPONLYL40) ) ;
  147.     MTL_resetAtrObj( tifMesId[4], (~MS_DSPONLYL40) ) ;
  148.     MTL_resetAtrObj( tifDButtonId[5], (~MS_DSPONLYL40) ) ;
  149.     MTL_resetAtrObj( tifMesId[5], (~MS_DSPONLYL40) ) ;
  150.  
  151.         /* êΩèçô]æù */
  152.     if( tifTMode == 0 )
  153.     {
  154.         MTL_setAtrObj( tifDButtonId[0], MS_INACTIVEL40 ) ;
  155.         MTL_setAtrObj( tifMesId[0], MS_INACTIVEL40 ) ;
  156.     }
  157.     else
  158.     {
  159.         MTL_setAtrObj( tifMesId[0], MS_DSPONLYL40 ) ;
  160.     }
  161.         /* ò\Ī,ìφÅ£,ĵô╛ */
  162.     if( tifTotal == tifPrt )
  163.     {
  164.         MTL_setAtrObj( tifDButtonId[2], MS_INACTIVEL40 ) ;
  165.         MTL_setAtrObj( tifMesId[2], MS_INACTIVEL40 ) ;
  166.         MTL_setAtrObj( tifDButtonId[3], MS_INACTIVEL40 ) ;
  167.         MTL_setAtrObj( tifMesId[3], MS_INACTIVEL40 ) ;
  168.         MTL_setAtrObj( tifDButtonId[4], MS_INACTIVEL40 ) ;
  169.         MTL_setAtrObj( tifMesId[4], MS_INACTIVEL40 ) ;
  170.     }
  171.     else
  172.     {
  173.         MTL_setAtrObj( tifMesId[2], MS_DSPONLYL40 ) ;
  174.         MTL_setAtrObj( tifMesId[3], MS_DSPONLYL40 ) ;
  175.         MTL_setAtrObj( tifMesId[4], MS_DSPONLYL40 ) ;
  176.     }
  177.         /* æ}ôⁿ */
  178.     if( cutNum == 0 )
  179.     {
  180.         MTL_setAtrObj( tifDButtonId[5], MS_INACTIVEL40 ) ;
  181.         MTL_setAtrObj( tifMesId[5], MS_INACTIVEL40 ) ;
  182.     }
  183.     else
  184.     {
  185.         MTL_setAtrObj( tifMesId[5], MS_DSPONLYL40 ) ;
  186.     }
  187.  
  188.     if( mode )
  189.     {
  190.         for( i=0 ; i<6 ; i++ )
  191.         {
  192.             atr2 = MS_DSPONLYL40 ;
  193.             atr2 = MTL_checkAtrObj( tifDButtonId[i], atr2 ) ;
  194.             if( atr2 != atr[i] )
  195.             {
  196.                 MMI_SendMessage( tifDButtonId[i], MM_SHOW, 0 ) ; /* î⌐é╣éΘ */
  197.                 MMI_SendMessage( tifMesId[i], MM_SHOW, 0 ) ;
  198.             }
  199.         }
  200.     }
  201.     return NOERR ;
  202. }
  203.  
  204. tifFileEditList1()
  205. {
  206.     int n, m ;
  207.     int prt, max, min, len, page ;
  208.  
  209.     n = 24 ; m = tifTotal + 23 ;
  210.     MMI_SendMessage( tifScrollBarId1, MM_SETSCROLL, 5,
  211.         n-1, n-1, (m < n)?(n - 1):(m - 1), n, 4 ) ;
  212.  
  213.     MMI_SendMessage( tifNumBoxId, MM_SETNUMBOX, 5,
  214.                             tifTotal, 0, tifTotal, 1, 0 ) ;
  215.  
  216.     MMI_SendMessage( tifScrollBarId1, MM_GETSCROLL, 5,
  217.                         &prt, &min, &max, &len, &page ) ;
  218.     MMI_SendMessage( tifScrollBarId1, MM_SETSCROLL, 5,
  219.                         tifPrt0+min, min, max, len, page ) ;
  220.     MMI_SendMessage( tifListMenuId1, MM_SETDSPROWCOLUM, 2, tifPrt0, 0 ) ;
  221.  
  222.     MMI_SendMessage( tifNumBoxId, MM_SHOW, 0 ) ;
  223.     MMI_SendMessage( tifScrollBarId1, MM_SHOW, 0 ) ;
  224.     MMI_SendMessage( tifListMenuId1, MM_SHOW, 0 ) ;
  225.  
  226.     return NOERR ;
  227. }
  228.  
  229. /*    initDataIRCTIF:tifListMenuId0:MJ_LMENUL40é╠î─é╤Åoé╡è╓Éö    */
  230. int    tifListFunc0(kobj, messId, argc, pev, trigger)
  231. int        kobj ;
  232. int        messId ;
  233. int        argc ;
  234. EVENT    *pev ;
  235. int        trigger ;
  236. {
  237.     if( trigger & MS_EVDRAGOUTL40 )
  238.     {
  239.         int prt, len, page ;
  240.         int max, min ;
  241.         int dy ;
  242.         POINT *ppt ;
  243.         HYPER hyp ;
  244.  
  245.         MMI_SendMessage( kobj, MM_GETHYPER, 1, &hyp ) ;
  246.         ppt = ( POINT *)&( pev->info ) ;
  247.         dy = 0 ;
  248.  
  249.         if( ppt->y < hyp.fr.lupy )
  250.             dy = -1 ;
  251.         if( ppt->y > hyp.fr.rdwy )
  252.             dy = 1 ;
  253.  
  254.         if( dy )
  255.         {
  256.             MMI_SendMessage( tifScrollBarId0, MM_GETSCROLL, 5,
  257.                         &prt, &min, &max, &len, &page ) ;
  258.  
  259.             prt += dy ;
  260.  
  261.             if( (min <= prt) && (prt <= max) )
  262.             {
  263.                 MMI_SendMessage( tifScrollBarId0, MM_SETSCROLL, 5,
  264.                         prt, min, max, len, page ) ;
  265.                 MMI_SendMessage( kobj, MM_SETDSPROWCOLUM, 2, prt-min, 0 ) ;
  266.                 MMI_SendMessage( tifScrollBarId0, MM_SHOW, 0 ) ;
  267.                 MMI_SendMessage( kobj, MM_SHOW, 0 ) ;
  268.             }
  269.         }
  270.         return NOERR ;
  271.     }
  272.  
  273.     if( tifTMode == 0 )
  274.     {
  275.         LISTITEML40 *plitem0, *plitem1 ;
  276.         int maxRow0, maxColum0 ;
  277.         int maxRow1, maxColum1 ;
  278.         int i, j ;
  279.  
  280.         if( tifTotal >= F_MAX )
  281.             return NOERR ;
  282.  
  283.         MMI_SendMessage( kobj, MM_GETLMENUPTR, 3,
  284.                         &plitem0, &maxRow0, &maxColum0 ) ;
  285.         MMI_SendMessage( tifListMenuId1, MM_GETLMENUPTR, 3,
  286.                         &plitem1, &maxRow1, &maxColum1 ) ;
  287.  
  288.         for( i=0 ; i<total ; i++ )
  289.         {
  290.             if( plitem0[i].selectFlag )
  291.             {
  292.                 if( tifTotal > tifPrt )
  293.                 {
  294.                     for( j=tifTotal ; j>tifPrt ; j-- )
  295.                     {
  296.                         if( plitem1[j-1].string != NULL )
  297.                         {
  298.                             MMI_SendMessage( tifListMenuId1, MM_SETROWCOLUM,
  299.                                  3, j, 0, plitem1[j-1].string ) ;
  300.                             plitem1[j].selectFlag = plitem1[j-1].selectFlag ;
  301.                         }
  302.                     }
  303.                     MMI_SendMessage( tifListMenuId1, MM_SETROWCOLUM,
  304.                          3, tifPrt, 0, plitem0[i].string ) ;
  305.                     plitem1[tifPrt].selectFlag = 0 ;
  306.                 }
  307.                 else
  308.                 {
  309.